using System;
using System.Windows.Forms;
using System.Drawing;


namespace WinformToolkit.Drawing
{
    /// <summary>
    /// Base class for all drawing tools
    /// </summary>
    abstract class Tool
    {

        /// <summary>
        /// Left mouse button is pressed
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public virtual void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
        {
        }


        /// <summary>
        /// Mouse is moved, left mouse button is pressed or none button is pressed
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public virtual void OnMouseMove(DrawArea drawArea, MouseEventArgs e)
        {
        }


        /// <summary>
        /// Left mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public virtual void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
        }

        public virtual void OnKeyDown(DrawArea drawArea, Keys keyData)
        { }

        public virtual void OnMouseWheel(DrawArea drawArea, MouseEventArgs e)
        { }



        public static RectangleF MakeRectangle(PointF center, float width, float height)
        {
            return new RectangleF(center.X - width / 2, center.Y - height / 2, width, height);
        }

        public static PointF GetCenter(RectangleF rectangle)
        {
            return new PointF()
            {
                X = rectangle.X + rectangle.Width / 2,
                Y = rectangle.Y + rectangle.Height / 2
            };
        }

    }
}
